Skip to content

k8s: wait for CoreDNS pods available before proceeding#783

Merged
ahmad-can merged 1 commit intocanonical:mainfrom
hemanthnakkina:coredns-wait-for-pods-ready
Apr 24, 2026
Merged

k8s: wait for CoreDNS pods available before proceeding#783
ahmad-can merged 1 commit intocanonical:mainfrom
hemanthnakkina:coredns-wait-for-pods-ready

Conversation

@hemanthnakkina
Copy link
Copy Markdown
Collaborator

@hemanthnakkina hemanthnakkina commented Apr 24, 2026

PatchCoreDNSStep runs a helm upgrade to apply HPA and resource settings to CoreDNS. Previously it waited for the k8s Juju application to reach active status, but the k8s charm does not react to external changes until the next update-status hook fires, so the application could be seen as active while CoreDNS pods were still restarting.

Replace the Juju application wait with a direct poll of the CoreDNS Deployment's availableReplicas field via the k8s API. The step now waits until availableReplicas >= minReplicas (replica_count), which ensures DNS is fully available before subsequent OpenStack deployment steps proceed.

Fixes: LP#2148371

Assisted-By: Claude:claude-4.6-sonnet

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves reliability of the OpenStack-on-K8s bootstrap by ensuring CoreDNS is actually serving traffic after the Helm-based CoreDNS HPA/resource patch, instead of relying on the Juju k8s application status (which may lag external changes).

Changes:

  • Replace wait_application_ready() with direct polling of the CoreDNS Deployment availableReplicas via the Kubernetes API.
  • Add unit tests covering the new CoreDNS readiness wait behavior and updated PatchCoreDNSStep.run() expectations.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
sunbeam-python/sunbeam/steps/k8s.py Adds _wait_for_coredns_ready() and switches PatchCoreDNSStep to poll CoreDNS Deployment availability after Helm upgrade.
sunbeam-python/tests/unit/sunbeam/steps/test_k8s.py Updates PatchCoreDNSStep tests to assert the new readiness wait and adds unit coverage for the polling helper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sunbeam-python/sunbeam/steps/k8s.py Outdated
@hemanthnakkina hemanthnakkina force-pushed the coredns-wait-for-pods-ready branch from a2fbf69 to 88d215e Compare April 24, 2026 04:28
PatchCoreDNSStep runs a helm upgrade to apply HPA and resource
settings to CoreDNS. Previously it waited for the k8s Juju
application to reach active status, but the k8s charm does not
react to external changes until the next update-status hook fires,
so the application could be seen as active while CoreDNS pods were
still restarting.

Replace the Juju application wait with a direct poll of the CoreDNS
Deployment's availableReplicas field via the k8s API. The step now
waits until availableReplicas >= minReplicas (replica_count), which
ensures DNS is fully available before subsequent OpenStack deployment
steps proceed.

Fixes: LP#2148371

Assisted-By: Claude:claude-4.6-sonnet
Signed-off-by: Hemanth Nakkina <hemanth.nakkina@canonical.com>
@hemanthnakkina hemanthnakkina force-pushed the coredns-wait-for-pods-ready branch from 88d215e to 8985db7 Compare April 24, 2026 05:08
@ahmad-can ahmad-can merged commit c3ee2a3 into canonical:main Apr 24, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants